#include "Base.h"
#include "Framebuffer.h"
#include "Vector4.h"

ui32 r=10,g=8,b=4,lastLine=-1;

void Process(ui32 x, ui32 y, Vector4 *c)
{
  if (lastLine != y)
  {
    // new color
    r = rand() % 255;
    g = rand() % 255;
    b = rand() % 255;
    lastLine = y;
  }
  c->x = r;
  c->y = g;
  c->z = b;
};

int main()
{
  srand(time(NULL));
  
  FramebufferInit();
  i32 slot = FramebufferCreate(1280, 720);
  FramebufferClear(0, NULL);

  Vector4 red;
  Vector4Clear(&red, 0);

  red.x = 1.0f;

  Framebuffer* temp = FramebufferGetRaw(slot);
  Vector4Copy(&temp->buffer[0], &red, 512);

  /*FramebufferRegister(slot, &Process);
  FramebufferProcess(slot, LINE);*/

  FramebufferWrite(slot, 2.2f, "untitled");
}
